import {request} from "@/utils/request";
import {getToken} from "@/utils/storage";

export function datalist() {
    return request({
        url:`/api/data/list`,
        method: 'get',
        headers: {"token": getToken()}
    })
}

export function getDataByCid(id) {
    return request({
        url:`/api/data/getLearnDataByCid/${id}`,
        method: "get",
        headers: {"token": getToken()}
    })
}

export function removeDataById(id) {
    return request({
        url:`/api/data/delete/${id}`,
        method: 'delete',
        headers: {"token": getToken()}
    })
}

export function saveData(data) {
    return request({
        url:`/api/data/add`,
        method: 'post',
        data: {
            cId: data.cId,
            type: data.type,
            url: data.url
        },
        headers: {"token": getToken()}
    })
}
